
if exists(select name from sysobjects where name = 'sp_SinhVienUpdateAllLyLich')
	drop proc sp_SinhVienUpdateAllLyLich
go
/*
	Created by: Phuoc NH
	Created on: 13/0/2013 (dd/mm/yyyy)
	Description: 
	--

	File:$sql-scripts/Proc.sp_SinhVienUpdateAllLyLich.sql
*/

create proc sp_SinhVienUpdateAllLyLich
@MaSinhVien varchar(50),
@DienThoai varchar(15),
@Email varchar(100),
@DiaChiHT Nvarchar(max),
@GioiTinh tinyint,
@Ten Nvarchar(50),
@Ho Nvarchar(20),
@NgaySinh varchar(10),
@CMTND varchar(15),
@HoKhau Nvarchar(1000),
@NoiSinh Nvarchar(1000),
@NamTotNghiep varchar(50),
@SoHieuBang12 varchar(10),
@DanToc int,
@TonGiao Nvarchar(50),
@NgayCap varchar(10),
@NoiCap nvarchar(500),
@HoTenBo Nvarchar(100),
@hoTenMe Nvarchar(100),
@NNBo NVarchar(max),
@NNMe Nvarchar(max),
@DiaChi Nvarchar(max),
@GhiChu Nvarchar(max)
as
begin
	set dateformat dmy
	update SinhVien set Ten=@Ten, Ho=@Ho, NgaySinh=@NgaySinh, GioiTinh=@GioiTinh, 
			CMTND=@CMTND, HoKhau=@HoKhau, NoiSinh=@NoiSinh, NamTN12=@NamTotNghiep, SoHieuBang12=@SoHieuBang12,
			DanToc=@DanToc, TonGiao=@TonGiao, NgayCap=@NgayCap, NoiCap=@NoiCap, HoTenBo=@HoTenBo, HoTenMe=@hoTenMe, NNBo=@NNBo, NNMe=@NNMe, DiaChi=@DiaChi, DiaChiHT=@DiaChiHT,
			 DienThoai=@DienThoai, GhiChu=@GhiChu, Email=@Email,
			 TrangThaiUpdate=2 where MaSinhVien=@MaSinhVien			
			 
	update sinhvien set NamTN12 = null where MaSinhVien=@MaSinhVien and NamTN12='1900'
	update sinhvien set ngaycap=null where MaSinhVien=@MaSinhVien and NgayCap='01/01/1900'
	
end



